package br.com.dlm.simuladoitil.activities;

import android.app.Activity;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.os.Bundle;
import br.com.dlm.simuladoitil.R;
import br.com.dlm.simuladoitil.basicas.Questao;
import br.com.dlm.simuladoitil.fragments.QuestaoFragment;

public class QuestaoActivity extends Activity {

    public static final String EXTRA_QUESTAO = "EXTRA_QUESTAO";
    public static final String EXTRA_NUMERO_QUESTAO = "EXTRA_NUMERO_QUESTAO";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_questao);

        Questao questao = (Questao) getIntent().getSerializableExtra(EXTRA_QUESTAO);
        int numeroQuestao = getIntent().getIntExtra(EXTRA_NUMERO_QUESTAO, 0);

        QuestaoFragment questaoFragment = QuestaoFragment.newInstance(questao, numeroQuestao);

        FragmentManager fragmentManager = getFragmentManager();
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        fragmentTransaction.replace(R.id.containerQuestao, questaoFragment, "QUESTAO");
        fragmentTransaction.commit();
    }
}
